import request from '@/utils/request'



export default {
    //查询全部
    getRoleList(searchModel) {
        return request({
            url: '/role/list',
            method: 'get',

            params: {
                pageNo: searchModel.pageNo,
                pageSize: searchModel.pageSize,
                roleName: searchModel.roleName
            }
        });
    },
    //新增
    addrole(role) {
        return request({
            url: '/role',
            method: 'post',
            data: role
        });
    },
    //删除
    delleterole(id) {
        return request({
            url: `/role/${id} `,
            method: 'delete',

        });
    },
    //修改
    updaterole(role) {
        return request({
            url: '/role',
            method: 'put',
            data: role
        });
    },
    saveRole(role) {
        if(role.roleId==null&&role.roleId==undefined){
        return this.addrole(role);
        }
         return this.updaterole(role);   
       
    },
    //查询  by  id
    getroleById(id) {
        return request({
            url: `/role/${id} `,
            method: 'get',

        });
    },
    getAllRoleList() {
        return request({
            url: '/role/all',
            method: 'get'
        });
    },
    

}